package afk.biglog;

public class Block
{
	private final int blockNumber;
	private long end;
	private final int linesPerBlock;
	private long start;

	public Block(final int blockNumber, final int linesPerBlock, final long start, final long end)
	{
		super();
		this.blockNumber = blockNumber;
		this.linesPerBlock = linesPerBlock;
		this.start = start;
		this.end = end;
	}

	@Override
	public boolean equals(final Object obj)
	{
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		final Block other = (Block) obj;
		if (blockNumber != other.blockNumber)
			return false;
		if (end != other.end)
			return false;
		if (linesPerBlock != other.linesPerBlock)
			return false;
		if (start != other.start)
			return false;
		return true;
	}

	public long getEnd()
	{
		return end;
	}

	public long getStart()
	{
		return start;
	}

	@Override
	public int hashCode()
	{
		final int prime = 31;
		int result = 1;
		result = prime * result + blockNumber;
		result = prime * result + (int) (end ^ (end >>> 32));
		result = prime * result + linesPerBlock;
		result = prime * result + (int) (start ^ (start >>> 32));
		return result;
	}

	public void setEnd(final long end)
	{
		this.end = end;
	}

	public void setStart(final long start)
	{
		this.start = start;
	}

	@Override
	public String toString()
	{
		return "Block [blockNumber=" + blockNumber + ", linesPerBlock=" + linesPerBlock + ", start=" + start + ", end=" + end + "]";
	}
}
